use vhdl_lang::ast::*;


pub fn entity(design: &DesignFile) -> Vec<EntityDeclaration> {
    let mut result: Vec<EntityDeclaration> = Vec::new();
    let du = design.design_units.clone();
    for unit in du {
        match unit {
            AnyDesignUnit::Primary(AnyPrimaryUnit::Entity(entity)) => result.push(entity),
            _ => (),
        }
    }
    result
}

pub fn architecture(design: &DesignFile) -> Vec<ArchitectureBody> {
    let mut result: Vec<ArchitectureBody> = Vec::new();
    let du = design.design_units.clone();
    for unit in du {
        match unit {
            AnyDesignUnit::Secondary(AnySecondaryUnit::Architecture(u)) => 
                result.push(u),
            _ => (),
        }
    }
    result
}

